package com.hnevc.vx.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.hnevc.vx.R;
import com.hnevc.vx.bean.LianxXiren;
import java.util.List;

public class MyAdapater3 extends BaseAdapter {
    Context context;
    private List<LianxXiren.ResultBean> lianbxirenList2;
    String TAG = "test";

    public MyAdapater3(Context context, List<LianxXiren.ResultBean> lianbxirenList2) {
        this.context = context;
        this.lianbxirenList2 = lianbxirenList2;
    }

    @Override
    public int getCount() {
        return lianbxirenList2.size();
    }

    @Override
    public Object getItem(int position) {
        return lianbxirenList2.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.item_fragment2, null);
        TextView textView1 = convertView.findViewById(R.id.item2_nc2_tv);
        textView1.setText(lianbxirenList2.get(position).getName());
        ImageView imageView = convertView.findViewById(R.id.item2_iv);
        String url = lianbxirenList2.get(position).getUrl();
        int imgid = context.getResources().getIdentifier(url, "drawable", context.getPackageName());
        Log.e(TAG, "getView: " + url);
        Log.e(TAG, "getView: " + imgid);
        imageView.setImageResource(imgid);
        return convertView;
    }
}
